package pt.ist.meic.pava;

import javassist.CtClass;


 /**
 * 
 * @author Antonio Massingue
 * @author Joao Matos
 * @author Nuno Santos
 * 
 * This Exception should be thrown when the @Trait annotation 
 * is used on a class inappropriately
 * 
 */
public class BadTraitUsageException extends Exception {

	/**
	 * The serial version Id
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * The annotated class
	 */
	private CtClass ctClass;
	
	
	
	

	/**
	 * Constructor
	 */
	public BadTraitUsageException() {
		super();
	}

	/**
	 * Constructor Overloaded
	 * @param aClass
	 */
	public BadTraitUsageException(CtClass aClass) {
		super();
		this.ctClass = aClass;
	}
	
	
	
	
	
	/**
	 * This method returns the detailed message of the
	 * thrown exception as a String
	 */
	public String getTraitMessage() {

		return "Erroneous usage of the @Trait annotation\n It is an error "
				+ "to use the @Trait annnotation on a non-abstract class or "
				+ "on a class that includes other members besides non-static "
				+ "methods ";

	}

	/**
	 * This method prints the detailed message of the thrown exception
	 */
	public void printBadTraitUsageExceptionDetailedMessage() {
		
		System.err.println("Erroneous usage of the @Trait annotation\n It is an error "
				+ "to use the @Trait annnotation on a non-abstract class or "
				+ "on a class that includes other members besides non-static "
				+ "methods ");
		
	}
	
	
	
	
	
	/**
	 * @return the ctClass
	 */
	public CtClass getCtClass() {
		return ctClass;
	}

	/**
	 * @param ctClass
	 */
	public void setCtClass(CtClass ctClass) {
		this.ctClass = ctClass;
	}

	
	
	
}
